package com.hangzhou.welbeing.welbeinginstrument.factory;

import android.support.v4.app.Fragment;

import com.hangzhou.welbeing.welbeinginstrument.fragement.CircleFragment;
import com.hangzhou.welbeing.welbeinginstrument.fragement.ReleaseHomePagerFragment;
import com.hangzhou.welbeing.welbeinginstrument.fragement.WeChatMallFragment;
import com.hangzhou.welbeing.welbeinginstrument.fragement.releaseMeFragment;

import java.util.HashMap;

/**
 * 杭州惟君医疗科技有限公司16
 * Created by 20433 on 2018/1/29
 */

public class MainFragmentFactory {
    private static final int CIRCLE = 1;
    private static final int HOME = 0;
    private static final int MALL = 2;
    private static final int ME = 3;
    private static HashMap<Integer, Fragment> mapAllCircle = new HashMap();

    public static Fragment CreateCircleObject(int position) {
        Fragment fragment = mapAllCircle.get(position);
        if (fragment == null)
        {
           switch (position){
               case HOME:
                   fragment = new ReleaseHomePagerFragment();
                   break;
               case CIRCLE:
                   fragment =  new CircleFragment();
                   break;
               case MALL:
                   fragment = new WeChatMallFragment();
                   break;
               case ME:
                   fragment = new releaseMeFragment();
                   break;
           }
            mapAllCircle.put(position,fragment);
            return fragment;
        }
        return fragment;
    }
}
